﻿using System;
using System.Diagnostics;
using ParallelRuntimeLibrary.Collections;
using ParallelRuntimeLibrary;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestProject
{
    static class ReaderWriterLockTest
    {
        public static void test()
        {
            ConcurrentList<string> asc = new ConcurrentList<string>();

            Stopwatch sw = new Stopwatch(); sw.Start();

            Parallel.For(0, 50000, (i, pls) =>
                {
                    asc.Add(i.ToString());
                    for (int ii = 0; ii < 30; ii++)
                    {
                        asc.Add(ii.ToString());
                    }
                    asc.Insert(asc.Count - 4, i.ToString());
                    asc.Insert(asc.Count - 4, i.ToString());
                    //asc.RemoveAt(asc.Count / 2);
                });

            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);
            Console.ReadLine();
        }
    }
}
